﻿{% extends "base.html" %}
{% load blog_tags comment_tags %}
{% block title %}
  {{ article.title }}
{% endblock %}
{% block css %}
  <link rel="stylesheet" href="{% static 'css/prism.css' %}">
{% endblock %}
{% block content %}
  <section class="section">
    <div class="container">
      <div class="content">
        <ul class="breadcrumb">
          <li>您的位置</li>
          <li>
            <a href="{% url 'blog:index' %}">首页</a>
          </li>
          <li>
            <a href="{% url 'blog:category' article.category.navigation.slug article.category.slug %}">
              {{ article.category.name }}
            </a>
          </li>
          <li><span class="active">正文</span></li>
        </ul>
        <article class="article">
          <h2 class="title">{{ article.title }}</h2>
          <div class="meta">
            <span>分类：<a href="{% url 'blog:category' article.category.navigation.slug article.category.slug %}">
              {{ article.category.name }}</a>
            </span>
            <span>作者：{{ article.user }}</span>
            <span>浏览：{{ article.views }}</span>
            <span>时间：{{ article.created_time }}</span>
            <span>评论：{% get_comment_count article.id %}</span>
          </div>
          <div class="article-content">
            {{ article.format_content|safe }}
          </div>
          <div class="post-tag">
            <span class="fa fa-tags" aria-hidden="true"></span>标签：
            {% for tag in article.tags.all %}
              <a href="{% url 'blog:tag' tag.slug %}">{{ tag.name }}</a>
            {% endfor %}
          </div>
          <div>
            <div class="post-loves">
              <a href="javascript:void(0);" class="loves">
                <i class="fa fa-heart-o"></i>
                <span>赞（{{ article.loves }}）</span>
              </a>
            </div>
            <div>
              <b>上一篇：</b>
              {% if prev_article %}
                <a href="{{ prev_article.get_absolute_url }}" class="article-tag">
                  {{ prev_article.title }}
                </a>
              {% else %}
                已经是第一篇了！
              {% endif %}
            </div>
            <div>
              <b>下一篇：</b>
              {% if next_article %}
                <a href="{{ next_article.get_absolute_url }}" class="article-tag">
                  {{ next_article.title }}
                </a>
              {% else %}
                已经是最后一篇了！
              {% endif %}
            </div>
          </div>
        </article>
        <div class="recommend">
          <h4 class="title">您可能感兴趣的:</h4>
          <ul>
            {% get_recommend_article article as article_list %}
            {% for article in article_list %}
              <li>
                <div class="pic">
                  <a href="{{ article.get_absolute_url }}" title="{{ article.title }}">
                    <img src="{{ article.img.url }}"
                         alt="{{ article.title }}"
                         class="wp-post-image">
                  </a>
                </div>
                <a class="description" href="{{ article.get_absolute_url }}" rel="bookmark"
                   title="{{ article.title }}">{{ article.title }}</a>
              </li>
            {% endfor %}
          </ul>
        </div>
        {% include 'comments.html' %}
      </div>
      <aside class="sidebar">
        {% include 'sidebar.html' %}
      </aside>
    </div>
  </section>
{% endblock %}

{% block js %}

  <script src="{% static 'js/prism.js' %}"></script>
  <script src="{% static 'js/commit.js' %}"></script>
  <script>
      $('pre').addClass("line-numbers");
  </script>
{% endblock %}